package cn.virens.common.project.generator.database.datasource.info;

import cn.virens.common.project.generator.database.datasource.types.JdbTypes;
import cn.virens.common.project.generator.database.utils.PathUtil;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
@SuppressWarnings("serial")
public class FieldInfo implements Serializable {
    private String cdefault;
    private String comment;
    private String order;
    private String type;
    private String name;
    private String key;

    public String getPropertyPackage() {
        return getJdbType().getTypePackage();
    }

    public String getPropertyType() {
        return getJdbType().getTypeName();
    }

    public String getPropertyName() {
        return PathUtil.camel1(name);
    }

    public String getMethodName() {
        return PathUtil.camel0(name);
    }

    public JdbTypes getJdbType() {
        return JdbTypes.pasre(type);
    }
}
